package org.nanotek.mq.send;

import java.util.Date;

import org.nanotek.cms.domain.lucene.BaseDocument;
import org.nanotek.cms.domain.message.BodyMessageContainer;
import org.nanotek.cms.domain.message.MessageType;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class BaseDocumentQueueSenderTest {

	private static ClassPathXmlApplicationContext ctx;

	public BaseDocumentQueueSenderTest() {
	}

	/**
	 * @param args
	 * @throws InterruptedException 
	 */
	public static void main(String[] args) throws InterruptedException {
		ctx = new ClassPathXmlApplicationContext(new String[] {"activemq-config/base-activemq-sender-context.xml"});
		MetaIndexerSenderService sender =  (MetaIndexerSenderService) ctx.getBean("metaIndexerSenderService");
		for (int i = 0 ; i < 10 ; i++){
			BodyMessageContainer msgContainer = new BodyMessageContainer();
			msgContainer.setId(new Date().getTime());
			msgContainer.setMessageType(MessageType.DocumentCreate);
			BaseDocument baseDocument = new BaseDocument();
			baseDocument.setId("This is the BaseDocumentID");
			baseDocument.setContent("This is the Base document content " + i + " " + new Date().getTime());
			baseDocument.setReferURL("THIS IS THE REFER URL " + i + " " + new Date().getTime());
			msgContainer.setBodyMessage(baseDocument);
			sender.sendMessage(msgContainer);
		}
		System.exit(0);
	}

}
